/**************************************************************
 *
 * Copyright (c) 2008, ******, All Rights Reserved.
 *
 * 名 称:
 *		def.h
 * 位 置:
 *		inc/pub/def.h
 * 描 述:
 *		公用宏定义
 * 备 注:
 *		无
 * 修 改:
 *		2008-09-20  Simon   - 创建
 *
 **************************************************************/

#ifndef __PUB_DEF_H__
#define __PUB_DEF_H__

#define APP_ERR					-1
#define APP_OK					0

//定义包类型
#define PACKTYPE_REQUEST		"R" //请求
#define PACKTYPE_RESPONSE		"A" //应答
#define PACKTYPE_SEND			"S" //主动发送
#define PACKTYPE_HEAD			"H" //包头(不允许使用)

//定义包记录类型
#define RECORDTYPE_NONE			"0" //没有记录
#define RECORDTYPE_SINGLE		"1" //单条记录
#define RECORDTYPE_MULTIPLE 	"*" //多条记录

//定义包记录分隔符
#define PACKRECORD_SEP 			"\n" //换行分隔

//定义包结束标志
#define PACKFINISH_NO 			"N" //未结束
#define PACKFINISH_YES 			"Y" //已结束

//定义元信息文件类型
#define METAFILE_PACK			1	//数据包信息文件
#define METAFILE_DICT			2	//数据字典信息文件
#define METAFILE_MENU			3	//菜单项信息文件

#define METAFILE_MAXSIZE        (1024*1024) //元信息文件最大

//定义错误缺省值
#define ERRCODE_RT				8000
#define ERRCODE_DB				8001
#define ERRCODE_IO				8002
#define ERRCODE_APP				8003

//定义功能码
#define SERVICECODE_INTERNAL 	"000000"

//定义日志输出目标
#define LOGTO_TUXEDO			0
#define LOGTO_STDOUT 			1
#define LOGTO_STDERR			2
#define LOGTO_FILE				3

//定义日志输出级别
#define LOGLVL_VERBOSE          0
#define LOGLVL_DEBUG            1
#define LOGLVL_INFO             2
#define LOGLVL_WARN             3
#define LOGLVL_ERROR     	   4

#define DBSQL_MAXLEN			1024
#define DBFLD_MAXLEN			60
#define DBVAL_MAXLEN			1024
#define DBROW_LOCK				0
#define DBROW_NOLOCK			1
#define DBTAB_LOCK				0
#define DBTAB_NOLOCK			1
#define DBTAB_NOWHERE			""
#define DBTAB_NOORDER			""
#define DBTAB_NOLIMIT			-1


#define SYSPARAM_SYSSTAT			"SysStatus"
#define SYSPARAM_WORKDAY			"TradeDate"
#define SYSPARAM_NEXTWORKDAY		"NextTradeDate"
#define SYSPARAM_DISTRIBUTORCODE	"DistributorCode"
#define SYSPARAM_LOGLEVEL			"LogLevel"
#define SYSPARAM_LOGTO				"LogTo"
#define SYSPARAM_LOGFILE			"LogFile"

#endif
